package com.kotlin.flong.base

/*
 * lambdaʾ
 */
fun main(args : Array<String>){

	var a   = 10
	var res1 = lambda1(a, { b-> b+10 })
	var res2 = lambda1(a,::add)

	println(res1)
	println(res2)


	var list  = arrayOf("liangjl" ,"","")

	var index = list.indexOfFirst { it.startsWith("") }

	//println(list[index])

	var find = list.find {  it.startsWith("") }

	println(find)

	var filter = list.filter { it.startsWith("")}

	println(filter)


	var mulist = mutableListOf<String>();

	list.filterTo(mulist,  { it.startsWith("liang") })

	println(mulist)

}

fun lambda1(a :Int ,block:(Int) -> Int) : Int{
	return block(a)
}


fun add(a : Int) : Int = a +10

